﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Maestro.master" AutoEventWireup="true" CodeFile="Marca.aspx.cs" Inherits="Marca" %>

<%@ Register assembly="DevExpress.Web.ASPxGridView.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView" tagprefix="dxwgv" %>
<%@ Register assembly="DevExpress.Web.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxPopupControl" tagprefix="dxpc" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dxe" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">

        .style2
        {
            height: 19px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <table cellspacing="1" align="center">
        <tr>
            <td align="center" bgcolor="White" >
                <table align="center">
                    <tr>
                        <td>
                            <dxe:ASPxTextBox ID="txtBuscar" runat="server" NullText="Ingrese un texto" 
                                    ontextchanged="txtBuscar_TextChanged" 
                                    ToolTip="Se buscará por Legajo/ Tarjeta / Nombre / Documento" Width="170px">
                                <ValidationSettings Display="Dynamic" ErrorText="Debe ingresar un valor" 
                                        ErrorTextPosition="Bottom" ValidationGroup="Buscar">
                                    <RequiredField IsRequired="True" />
                                </ValidationSettings>
                            </dxe:ASPxTextBox>
                                </aspxtextbox>
                            </td>
                        <td>
                            <asp:ImageButton ID="btnBuscar" runat="server" Height="22px" 
                                    ImageUrl="~/Imagenes/lupa.gif" onclick="btnBuscar_Click1" ToolTip="Buscar" 
                                    CausesValidation="False" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td>
            </td>
        </tr>
        <tr>
            <td align="center" bgcolor="White" class="style3">
                <asp:FormView ID="fvMarca" runat="server" DataSourceID="dsMarca" 
                        oniteminserting="fvPersonal_ItemInserting" EnableModelValidation="True" 
                        Width="128px">
                    <EditItemTemplate>
                        <table cellpadding="2" cellspacing="2" class="style1">
                            <tr>
                                <td class="style8">
                                        Nombre</td>
                                <td>
                                    <asp:TextBox ID="NombreTextBox" runat="server" Text='<%# Bind("Nombre") %>' />
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                                            ControlToValidate="NombreTextBox" ErrorMessage="RequiredFieldValidator" 
                                            ToolTip="Debe ingresar un valor" ValidationGroup="EditarInsertar">*</asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td class="dxncEmptyData_Soft_Orange">
                                        Estado</td>
                                <td nowrap="nowrap">
                                    <table cellpadding="0" cellspacing="0">
                                        <tr>
                                            <td class="style3">
                                                <asp:Label ID="lblEstado" runat="server" ForeColor='<%# Eval("EstadoColor") %>' 
                                                        Text='<%# Eval("EstadoString") %>' />
                                                    &nbsp;
                                                </td>
                                            <td class="style3">
                                                <dxe:aspxbutton ID="btnActivar" runat="server" 
                                                             CssFilePath="~/App_Themes/Office2003Olive/{0}/styles.css" 
                                                             CssPostfix="Office2003_Olive" Text="Activar" onclick="btnActivar_Click" 
                                                             Visible='<%# Eval("EstadoPuedeActivar") %>' 
                                                             ValidationGroup="EditarInsertar">
                                                </dxe:ASPxButton>
                                                <dxe:aspxbutton ID="btnInactivo" runat="server" 
                                                             CssFilePath="~/App_Themes/Office2003Olive/{0}/styles.css" 
                                                             CssPostfix="Office2003_Olive" Text="Eliminar" onclick="btnInactivo_Click" 
                                                             Visible='<%# Eval("EstadoPuedeInactivar") %>' 
                                                             ValidationGroup="EditarInsertar">
                                                    <ClientSideEvents Click="function(s,e) { e.processOnServer = confirm('Va a eliminar el registro, ¿está seguro?'); }" />
                                                </dxe:ASPxButton>
                                            </td>
                                            <td class="style3">
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td class="style4">
                                        &nbsp;</td>
                                <td style="margin-left: 160px">
                                        &nbsp;</td>
                            </tr>
                            <tr>
                                <td colspan="2" style="margin-left: 160px" nowrap="nowrap">
                                    <table align="center">
                                        <tr>
                                            <td>
                                                <dxe:aspxbutton ID="btnActualizar" runat="server" CommandName="Update" 
                                                        CssFilePath="~/App_Themes/Office2003Olive/{0}/styles.css" 
                                                        CssPostfix="Office2003_Olive" Text="Actualizar" 
                                                        ValidationGroup="EditarInsertar">
                                                </dxe:ASPxButton>
                                            </td>
                                            <td>
                                                    &nbsp;</td>
                                            <td>
                                                <dxe:aspxbutton ID="btnCancelar" runat="server" CausesValidation="False" 
                                                        CommandName="Cancel" CssFilePath="~/App_Themes/Office2003Olive/{0}/styles.css" 
                                                        CssPostfix="Office2003_Olive" Text="Cancelar" 
                                                        ValidationGroup="EditarInsertar">
                                                </dxe:ASPxButton>
                                            </td>
                                        </tr>
                                    </table>
                                    <asp:HiddenField ID="hfID" runat="server" 
                                            Value='<%# Bind("ID") %>' />
                                    <asp:HiddenField ID="hfEstaActivo" runat="server" 
                                            Value='<%# Bind("EstaActivo") %>' />
                                        &nbsp;</td>
                            </tr>
                        </table>
&nbsp;
                        </EditItemTemplate>
                    <EmptyDataTemplate>
                        <table align="center" class="style1">
                            <tr>
                                <td>
                                        &nbsp;</td>
                            </tr>
                            <tr>
                                <td>
                                        &nbsp;</td>
                            </tr>
                            <tr>
                                <td align="center" width="400">
                                    <asp:Label ID="Label1" runat="server" Text="Seleccione una unidad de medida" Width="400px" 
                                            style="color: #808080"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                        &nbsp;</td>
                            </tr>
                            <tr>
                                <td>
                                        &nbsp;</td>
                            </tr>
                        </table>
                    </EmptyDataTemplate>
                    <InsertItemTemplate>
                        <table cellpadding="2" cellspacing="2" class="style1">
                            <tr>
                                <td class="style8">
                                        Nombre</td>
                                <td>
                                    <asp:TextBox ID="NombreTextBox" runat="server" Text='<%# Bind("Nombre") %>' />
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                                            ControlToValidate="NombreTextBox" ErrorMessage="RequiredFieldValidator" 
                                            ToolTip="Debe ingresar un valor">*</asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td class="style4">
                                        &nbsp;</td>
                                <td style="margin-left: 160px">
                                        &nbsp;</td>
                            </tr>
                            <tr>
                                <td colspan="2" nowrap="nowrap" style="margin-left: 160px">
                                    <table align="center">
                                        <tr>
                                            <td>
                                                <dxe:aspxbutton ID="btnInsertar" runat="server" CommandName="Insert" 
                                                        CssFilePath="~/App_Themes/Office2003Olive/{0}/styles.css" 
                                                        CssPostfix="Office2003_Olive" Text="Insertar">
                                                </dxe:ASPxButton>
                                            </td>
                                            <td>
                                                    &nbsp;</td>
                                            <td>
                                                <dxe:aspxbutton ID="btnCancelar0" runat="server" CausesValidation="False" 
                                                        CommandName="Cancel" CssFilePath="~/App_Themes/Office2003Olive/{0}/styles.css" 
                                                        CssPostfix="Office2003_Olive" Text="Cancelar">
                                                </dxe:ASPxButton>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <table class="style1" cellpadding="2" cellspacing="2">
                            <tr>
                                <td class="dxncEmptyData_Soft_Orange">
                                        Nombre</td>
                                <td>
                                    <asp:Label ID="lblnombre" runat="server" 
                                            Text='<%# Eval("Nombre") %>' />
                                </td>
                            </tr>
                            <tr>
                                <td class="style2">
                                        Estado</td>
                                <td style="text-align: left" class="style2">
                                    <asp:Label ID="lblEstado0" runat="server" ForeColor='<%# Eval("EstadoColor") %>' 
                                            Text='<%# Eval("EstadoString") %>' />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                        &nbsp;</td>
                                <td style="margin-left: 160px">
                                        &nbsp;</td>
                            </tr>
                            <tr>
                                <td colspan="2" align="center">
                                    <table>
                                        <tr>
                                            <td>
                                                <dxe:aspxbutton ID="btnEditar" runat="server" CommandName="Edit" 
                                                        CssFilePath="~/App_Themes/Office2003Olive/{0}/styles.css" 
                                                        CssPostfix="Office2003_Olive" Text="Editar">
                                                </dxe:ASPxButton>
                                            </td>
                                            <td>
                                                <dxe:aspxbutton ID="btnNuevo" runat="server" CommandName="New" 
                                                        CssFilePath="~/App_Themes/Office2003Olive/{0}/styles.css" 
                                                        CssPostfix="Office2003_Olive" Text="Nuevo" 
                                                        ToolTip="Crea un nueva unidad de medida">
                                                </dxe:ASPxButton>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </ItemTemplate>
                </asp:FormView>
            </td>
        </tr>
    </table>
    <asp:ObjectDataSource ID="dsMarca" runat="server" 
        OldValuesParameterFormatString="original_{0}" 
        SelectMethod="CrearStockMarca" 
    TypeName="SGT_ON.StockMarca" 
    DataObjectTypeName="SGT_ON.StockMarca" DeleteMethod="Eliminar" 
    InsertMethod="Insertar" UpdateMethod="Actualizar" 
        oninserted="dsUnidadDeMedida_Inserted">
        <SelectParameters>
            <asp:QueryStringParameter DefaultValue="-1" Name="pID" QueryStringField="ID" 
                Type="Int32" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <br />
    <dxpc:aspxpopupcontrol ID="popBusqueda" runat="server" 
            AutoUpdatePosition="True" 
            CssFilePath="~/App_Themes/Office2003Olive/{0}/styles.css" 
            CssPostfix="Office2003_Olive" EnableHotTrack="False" 
            HeaderText="Unidades de Medida" 
            ImageFolder="~/App_Themes/Office2003Olive/{0}/" Modal="True" 
            PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter">
        <CloseButtonImage Height="12px" Width="13px" />
        <SizeGripImage Height="16px" Width="16px" />
        <HeaderStyle>
        <Paddings PaddingRight="6px" />
        </HeaderStyle>
        <ContentCollection>
            <dxpc:PopupControlContentControl runat="server" SupportsDisabledAttribute="True">
                <table align="center">
                    <tr>
                        <td align="center">
                            <dxwgv:ASPxGridView ID="gvMarcas" runat="server" 
        AutoGenerateColumns="False" 
        CssFilePath="~/App_Themes/Office2003Olive/{0}/styles.css" 
        CssPostfix="Office2003_Olive" DataSourceID="dsMarcas" 
        KeyFieldName="ID" style="text-align: left" Width="100%">
                                <Columns>
                                    <dxwgv:GridViewDataTextColumn Caption="Marca" 
                ShowInCustomizationForm="True" VisibleIndex="0">
                                        <DataItemTemplate>
                                            <a ID="clickElement" href="Marca.aspx?ID=<%# Container.KeyValue%>" 
                        target="_self"><%# Eval("Nombre")%></a>
                                        </DataItemTemplate>
                                        <CellStyle Wrap="False">
                                        </CellStyle>
                                    </dxwgv:GridViewDataTextColumn>
                                </Columns>
                                <SettingsBehavior AllowFocusedRow="True" EnableRowHotTrack="True" />
                                <SettingsPager PageSize="20">
                                </SettingsPager>
                                <Images ImageFolder="~/App_Themes/Office2003Olive/{0}/">
                                    <CollapsedButton Height="12px" 
                Url="~/App_Themes/Office2003Olive/GridView/gvCollapsedButton.png" 
                Width="11px" />
                                    <ExpandedButton Height="12px" 
                Url="~/App_Themes/Office2003Olive/GridView/gvExpandedButton.png" Width="11px" />
                                    <DetailCollapsedButton Height="12px" 
                Url="~/App_Themes/Office2003Olive/GridView/gvCollapsedButton.png" 
                Width="11px" />
                                    <DetailExpandedButton Height="12px" 
                Url="~/App_Themes/Office2003Olive/GridView/gvExpandedButton.png" Width="11px" />
                                    <FilterRowButton Height="13px" Width="13px" />
                                </Images>
                                <Styles CssFilePath="~/App_Themes/Office2003Olive/{0}/styles.css" 
            CssPostfix="Office2003_Olive">
                                    <Header ImageSpacing="5px" SortingImageSpacing="5px">
                                    </Header>
                                    <LoadingPanel ImageSpacing="10px">
                                    </LoadingPanel>
                                </Styles>
                                <StylesEditors>
                                    <ProgressBar Height="25px">
                                    </ProgressBar>
                                </StylesEditors>
                                <Templates>
                                    <EmptyDataRow>
                                        <br />
                                        <span class="dxncEmptyData_Soft_Orange">No se encontraron registros</span><br />
                                    </EmptyDataRow>
                                </Templates>
                            </dxwgv:ASPxGridView>
                        </td>
                    </tr>
                </table>
                <asp:ObjectDataSource ID="dsMarcas" runat="server" 
        SelectMethod="ObtenerPorTexto" 
        TypeName="SGT_ON.StockMarca" 
        OldValuesParameterFormatString="original_{0}">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="txtBuscar" Name="pTexto" PropertyName="Text" 
                Type="String" />
                    </SelectParameters>
                </asp:ObjectDataSource>
            </dxpc:PopupControlContentControl>
        </ContentCollection>
    </dxpc:aspxpopupcontrol>
</asp:Content>

